package com.sikaryofficial.backend.controller;

import com.sikaryofficial.backend.manager.FileMd5Manager;
import com.sikaryofficial.common.core.domain.R;
import com.sikaryofficial.common.core.web.controller.BaseController;
import com.sikaryofficial.system.api.domain.SysFile;
import com.sikaryofficial.system.api.model.FileMd5VO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 文件MD5Controller
 *
 * @author qinjinyuan
 * @date 2024-08-09
 */
@RestController
@RequestMapping("/fileMd5")
@Api(tags = "品牌口味评价回复")
public class FileMd5Controller extends BaseController {
    @Autowired
    private FileMd5Manager fileMd5Manager;

    /**
     * 获取文件MD5详细信息
     */
    @ApiOperation("新增品牌口味评价回复")
    @GetMapping(value = "/{md5}")
    public R<SysFile> getInfo(@PathVariable("md5") String md5) {
        return R.ok(fileMd5Manager.getInfo(md5));
    }

    /**
     * 新增文件MD5
     */
    @PostMapping(value = "/add")
    @ApiOperation("新增品牌口味评价回复")
    public R<Boolean> add(@RequestBody FileMd5VO fileMd5) {
        return R.ok(fileMd5Manager.save(fileMd5));
    }
}
